package com.base.date;


import java.util.Date;

/**
 * 日期类的比较
 */
public class DateCompare {


    public void compareDate1() {
        Date date1 = new Date();
        Date date2 = new Date(System.currentTimeMillis() - 1);
        System.out.println(date1.compareTo(date2));
    }

    public void compareDate2() {
        Date date1 = new Date();
        Date date2 = new Date(System.currentTimeMillis() - 1);
        System.out.println(date1.before(date2));
    }
}
